package com.cysyz.mylib.excel.engine.impl.jxl;

import java.util.ArrayList;
import java.util.List;

import jxl.Cell;
import jxl.Sheet;

import com.cysyz.mylib.excel.engine.CellEngine;
import com.cysyz.mylib.excel.engine.SheetEngine;

public class SheetEngineJxlImpl implements SheetEngine{
	private  Sheet sheet;
	public SheetEngineJxlImpl(Sheet sheet) {
		this.sheet = sheet;
	}
	@Override
	public String getName() {
		return sheet.getName();
	}
	@Override
	public List<CellEngine> getOneRowCells(int i) {
		Cell[] oneRowCells = sheet.getRow(i);
		List<CellEngine> cellEngineJxlImpls = new ArrayList<CellEngine>(); 
		for (Cell cell : oneRowCells) {
			cellEngineJxlImpls.add(new CellEngineJxlImpl(cell));
		}
		return cellEngineJxlImpls;
	}
	@Override
	public int getRowCount() {
		return sheet.getRows();
	}
}
